package com.tyf.common.vo;

import java.util.List;

import com.tyf.common.util.Collections3;
import com.google.common.collect.Lists;

/**
 * 
 * @ClassName: SimpleSaveRequest<br>
 * @Description: 单表保存-请求接口<br>
 * @author liutao<br>
 * @date 2016年10月12日上午8:51:42<br>
 *
 */
public class SimpleSaveRequest<T> {

	private   List<T> insertRows;	//新增行

	private List<T> updateRows;		//修改行
	
	private List<T> deleteRows;		//删除行
	
	public List<T> getInsertRows() {
		return insertRows;
	}

	public void setInsertRows(List<T> insertRows) {
		this.insertRows = insertRows;
	}

	public List<T> getDeleteRows() {
		return deleteRows;
	}

	public void setDeleteRows(List<T> deleteRows) {
		this.deleteRows = deleteRows;
	}

	public List<T> getUpdateRows() {
		return updateRows;
	}

	public void setUpdateRows(List<T> updateRows) {
		this.updateRows = updateRows;
	}
	
	public boolean isEmpty(){
		return  (Collections3.isEmpty(deleteRows)
					&& Collections3.isEmpty(updateRows) 
					&& Collections3.isEmpty(insertRows));
	}
	
	public static <T> SimpleSaveRequest<T> newSimpleSaveRequest(){
		SimpleSaveRequest<T> m = new SimpleSaveRequest<T>();
		m.updateRows = Lists.newArrayList();
		m.deleteRows = Lists.newArrayList();
		m.insertRows = Lists.newArrayList();
		
		return m;
	}
}
